projects
/
project
/
procd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
747efb6
)
trace: Use properly sized type for PTRACE_GETEVENTMSG
author
Michal Sojka
<
[email protected]
>
Mon, 30 Jul 2018 07:31:09 +0000
(09:31 +0200)
committer
John Crispin
<
[email protected]
>
Mon, 30 Jul 2018 13:24:15 +0000
(15:24 +0200)
Without this, on 64-bit systems, ptrace call corrupts memory because
it stores 64bit value to 32bit pid_t variable.
Signed-off-by: Michal Sojka <
[email protected]
>
trace/trace.c
patch
|
blob
|
history
diff --git
a/trace/trace.c
b/trace/trace.c
index 27cf10895163b548814eb7daa37e60942efb24ae..665c22ef814a5f98939816d964ba38de60116494 100644
(file)
--- a/
trace/trace.c
+++ b/
trace/trace.c
@@
-211,7
+211,9
@@
static void tracer_cb(struct uloop_process *c, int ret)
(ret >> 8) == (SIGTRAP | (PTRACE_EVENT_CLONE << 8))) {
struct tracee *child = calloc(1, sizeof(struct tracee));
- ptrace(PTRACE_GETEVENTMSG, c->pid, 0, &child->proc.pid);
+ unsigned long msg;
+ ptrace(PTRACE_GETEVENTMSG, c->pid, 0, &msg);
+ child->proc.pid = msg;
child->proc.cb = tracer_cb;
ptrace(ptrace_restart, child->proc.pid, 0, 0);
uloop_process_add(&child->proc);